package com.success.application.shop;

import android.os.Bundle;
import android.view.View;

import com.google.gson.reflect.TypeToken;
import com.success.application.api.YuanbaoApi;
import com.success.application.base.BaseRecyclerViewAdapter;
import com.success.application.base.BaseRecyclerViewFragment;
import com.success.application.common.param.Params;
import com.success.application.common.result.Result;
import com.success.application.shop.adapter.ActivityListAdapter;
import com.success.application.shop.bean.HuoDong;
import com.success.application.shop.bean.Join;
import com.success.application.user.AccountHelper;
import com.success.application.widget.SimplexToast;

import java.lang.reflect.Type;

/**
 * Created by WYN on 2017/3/21.
 */

public class ActivityListFragment extends BaseRecyclerViewFragment<Join> {

    public static final String POINT_DETAILS_ID = "point_details_id";

    private HuoDong mHuodong;

    private int mCurrentPosition;
    @Override
    protected BaseRecyclerViewAdapter<Join> getRecyclerAdapter() {
        return new ActivityListAdapter(mContext, BaseRecyclerViewAdapter.ONLY_FOOTER);
    }

    @Override
    protected void initBundle(Bundle bundle) {
        super.initBundle(bundle);
        mHuodong = (HuoDong) bundle.getSerializable(POINT_DETAILS_ID);
    }

    @Override
    protected Type getType() {
        return new TypeToken<Result<Join>>() {
        }.getType();
    }

    @Override
    protected void initWidget(View root) {
        super.initWidget(root);
    }

    @Override
    protected void initData() {
        super.initData();
    }

//    @Override
//    public void onItemClick(int position, long itemId) {
//        this.mCurrentPosition = position;
////        Consult consult = ;
////        Intent intent = new Intent(getActivity(), ConsultDetailActivity.class);
////        intent.putExtra(BUNDLE_KEY_CONSULT, consult);
////        startActivityForResult(intent, REQUEST_CODE_MODIFY);
//    }

    @Override
    protected void requestData() {
        try {
            Params P = new Params();
            P.put("hdId",mHuodong.getId());
            YuanbaoApi.listBmData(P, mHandler);
        } catch (Exception e) {
            SimplexToast.show(mContext,"读取数据失败！");
            e.printStackTrace();
        }
    }
}
